public class circulation {
    public static void main(String[] args) {
        //do while
        //至少会执行一次
        int num = 10;
        do{
            System.out.println(num);
            num++;
        }while(num <= 9);
    }

    public static void main9(String[] args) {
        //for循环
        for (int i = 0; i < 100; i++) {
            System.out.println(i);
        }
        int sum = 0;
        for (int i = 0; i <=5 ; i++) {
            int ret = 1;
            for (int j = 1; j <= i; j++) {
                ret *= j;
            }
            sum += ret;
        }
        System.out.println(sum);
    }

    public static void main8(String[] args) {
//        for (int i = 1  ; i < 100; i++) {
//            if(i % 5 != 0 || i % 3 != 0){
//                continue;
//            }
//                System.out.println(i);
//
//        }
        int i = 1;
        while(i <= 100) {
            if(i % 15 != 0) {
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }

    }

    public static void main7(String[] args) {
        //break和continue
        int a = 10;
        while(a >= 0) {
            if(a == 9) {
                break;
            }
            a--;
        }
    }

    public static void main6(String[] args) {
        //死循环
//        while(true) {
//            System.out.println("haha");
//        }
//        int a = 1;
//        while(a >= 0) {
//            System.out.println("hehe");
        //此时while是一个空语句，死循环
//        int num = 1;
//        while(num <= 10); {
//            System.out.println(num + "asod");
//            num++;
//        }
//        for(;;) {
//            System.out.println("ok");
//        }
//        for(;true;){
//            System.out.println("no");
//        }
//        int a = 10;
//        for(;a>=0;){
//            System.out.println("ok");
//        }
    }

    public static void main5(String[] args) {
        //求阶乘·之和
        int i = 1;
        int ret1 = 0;
        while(i <= 5) {
            int n = 1;
            int ret = 1;
            while(n <= i) {
                ret *= n;
                n++;
            }
            ret1 += ret;
            i++;
        }
        System.out.println(ret1);
    }

    public static void main4(String[] args) {
        //求阶乘之和
        int i = 1;
        int ret = 1;
        int sum = 0;
        for (i = 1; i <= 5; i++) {
            ret *= i;
            sum += ret;
        }
        System.out.println(sum);
        //求阶乘
        i = 1;
         ret = 1;
        while(i <= 5) {
            ret *= i;
            i++;
        }
        System.out.println(ret);
    }

    public static void main3(String[] args) {
        //1-100的和
        //1-100的奇数和
        //1-100的偶数和
        int i = 0;
        int sum = 0;
        int sumOdd = 0;
        int sumEve = 0;
        while(i <= 100){
            if(i % 2 == 0){
                sumEve +=i;
            }else{
                sumOdd +=i;
            }
            sum += i;
            i++;
        }
        System.out.println(sumOdd);
        System.out.println(sumEve);
        System.out.println(sum);
    }


    public static void main2(String[] args) {
        int i = 0;
        while(i <=10) {
            System.out.println(i);
            i++;
        }

        //求1-100的和
        //法1
        int num = 0;
        int j = 1;
        while(j <=100){
            num += j;
            j++;
        }
        System.out.println(num);
        //法2(首项加尾项乘以项数除于2）
        int sum = 0;
        int n = 100;
        sum = (1+n) * (n/2);
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        int num = 10;
        if (num > 10 && num < 20)
            System.out.println("hehe");
//        switch(num > 10 && num <20)switch不能表达复杂条件

        //switch虽然支持嵌套，但是很丑，不推荐
        int x = 1;
        int y = 1;
        switch (x) {
            case 1:
                switch (y) {
                    case 1:
                        System.out.println("hehe");
                        break;
                }
                break;
            case 2:
                System.out.println("haha");
                break;
        }
    }
//        int day = 1;
//        switch(day){
//            case 1:
//                System.out.println("星期一");
//                break;
//            case 2:
//                System.out.println("星期二");
//                break;
//                case 3:
//                System.out.println("星期三");
//                break;
//                case 4:
//                System.out.println("星期四");
//                break;
//                case 5:
//                System.out.println("星期五");
//                break;
//                case 6:
//                System.out.println("星期六");
//                break;
//                case 7:
//                System.out.println("星期日·");
//                break;
//        }
//    }
}
